﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Prism.Logging;
using YasharEl.Infrastructure.Diagnostics.Logging;
using System.Diagnostics.Contracts;

namespace YasharEl.Infrastructure.PresentationModel.PrismIntegration.Bootstrap
{
    internal class PrismLogger : ILoggerFacade
    {
        #region ReadOnly Fields

        private readonly ILogger logger;

        #endregion

        #region Constructors

        public PrismLogger(ILogger logger)
        {
            Contract.Requires<ArgumentNullException>(logger != null, "logger could not be null.");

            this.logger = logger;
        }

        #endregion

        #region ILoggerFacade Members

        public void Log(string message, Category category, Priority priority)
        {
            switch (category)
            {
                case Category.Debug:
                    logger.Debug(message);
                    break;
                case Category.Exception:
                    logger.Error(message);
                    break;
                case Category.Info:
                    logger.Info(message);
                    break;
                case Category.Warn:
                    logger.Warn(message);
                    break;
                default:
                    break;
            }
        }

        #endregion
    }
}
